package com.example.houseman.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * 户型-室
 *
 * @author lzj
 */
@Getter
public enum HuxingShi {
    HUXING_ROOM1("1", 1),
    HUXING_ROOM2("2", 2),
    HUXING_ROOM3("3", 3),
    HUXING_ROOM4("4", 4),
    HUXING_ROOM5("5", 5),
    HUXING_ROOM6("6", 6),
    HUXING_ROOM7("7", 7),
    HUXING_ROOM8("8", 8),
    HUXING_ROOM9("9", 9);

    @JsonValue
    private String name;
    @EnumValue
    private int index;

    private HuxingShi(String name, int index) {
        this.index = index;
        this.name = name;
    }

    // 普通方法
    public static String getName(int index) {
        for (HuxingShi c : HuxingShi.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
